package br.com.medvagas.comum.entidade;

import java.io.Serializable;
import java.util.List;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * The persistent class for the uf database table.
 * 
 */
@Entity
@Table(name="uf")
@NamedQueries({
	@NamedQuery(
		name="Uf.consultarTodos", 
		query="select distinct u from Uf u")
})  
public class Uf implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="sigla_uf")
	private String siglaUf;

	@Column(name="cod_regiao")
	private Integer codRegiao;

	private String nome;

	//bi-directional many-to-one association to Empresa
	@OneToMany(mappedBy="uf", fetch=FetchType.LAZY)
	private Set<Empresa> empresas;

	//bi-directional many-to-one association to Municipio
	@OneToMany(mappedBy="uf", fetch=FetchType.LAZY)
	private List<Municipio> municipios;

    public Uf() {
    }

	@Override
	public String toString() {
		return "sigla=" + siglaUf;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((siglaUf == null) ? 0 : siglaUf.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Uf other = (Uf) obj;
		if (siglaUf == null) {
			if (other.siglaUf != null)
				return false;
		} else if (!siglaUf.equals(other.siglaUf))
			return false;
		return true;
	}

	public String getSiglaUf() {
		return this.siglaUf;
	}

	public void setSiglaUf(String siglaUf) {
		this.siglaUf = siglaUf;
	}

	public Integer getCodRegiao() {
		return this.codRegiao;
	}

	public void setCodRegiao(Integer codRegiao) {
		this.codRegiao = codRegiao;
	}

	public String getNome() {
		return this.nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public Set<Empresa> getEmpresas() {
		return this.empresas;
	}

	public void setEmpresas(Set<Empresa> empresas) {
		this.empresas = empresas;
	}
	
	public List<Municipio> getMunicipios() {
		return this.municipios;
	}

	public void setMunicipios(List<Municipio> municipios) {
		this.municipios = municipios;
	}
	
}